import request from '@/utils/request'

const api_name = `/api/order/orderInfo`

export default {
  submitOrder (scheduleId, hosScheduleId, patientId) {
    return request({
      url: `${api_name}/auth/submitOrder/${scheduleId}/${hosScheduleId}/${patientId}`,
      method: 'post'
    })
  },

  /**
   * 订单列表
   * @param page 当前页
   * @param limit 每页最大记录数
   * @param searchObj 查询实体
   * @returns {AxiosPromise}
   */
  getPageList (page, limit, searchObj) {
    return request({
      url: `${api_name}/auth/${page}/${limit}`,
      method: 'get',
      params: searchObj
    })
  },

  /**
   * 查询订单状态
   * @returns {AxiosPromise}
   */
  getStatusList () {
    return request({
      url: `${api_name}/auth/getStatusList`,
      method: 'get'
    })
  },

  /**
   * 根据订单ID查询订单详情
   * @param orderId 订单ID
   * @returns {AxiosPromise}
   */
  getOrders (orderId) {
    return request({
      url: `${api_name}/auth/getOrders/${orderId}`,
      method: 'get'
    })
  },

  cancelOrder (orderId) {
    return request({
      url: `${api_name}/auth/cancelOrder/${orderId}`,
      method: 'get'
    })
  }
}
